<?php
namespace Admin\Controller;

use Util\AccessController;

class CardController extends AccessController {

    public function Index() {
        $LS = Service('Card','card');
        $DATA = $LS->query(array('STATE'=>$_GET['STATE']));
        $this->DATA = $DATA;
        $this->display();
    }
    public function Add(){
        $LS = Service('Card','card');
        $OK = $LS->insert($_POST);
        $OK ?$this->success('添加成功'):$this->error('添加失败');
    }
    public function Card_log_Index(){
        $LS = Service('Card','card_log');
        $DATA = $LS->query(array('ts_card.STATE'=>1),null,'ts_card_log.*,ts_card.NAME as card_name,ts_u_user.user_wx_name as wx_name ',null,'ts_card on ts_card.ID = ts_card_log.CARD_ID','ts_u_user on ts_u_user.user_id = ts_card_log.USER_ID');
        $this->DATA = $DATA;
        $this->display();
    }

}